﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using MsForgeReboot.Framework.TownCrierChannels;

namespace MsForgeReboot.Framework.TownCrierChannels {
    public class MetaweblogChannelSection : ConfigurationSection {
        private static ConfigurationProperty _httpbasicauth;
        private static ConfigurationProperty _baseurl;
        private static ConfigurationProperty _postresource;
        private static ConfigurationProperty _blogid;

        [ConfigurationProperty("httpBasicAuth", IsRequired = true)]
        public HttpBasicAuthConfigurationElement HttpBasicAuth {
            get { return (HttpBasicAuthConfigurationElement)base[_httpbasicauth]; }
        }


        [ConfigurationProperty("apiBaseUrl", IsRequired = true)]
        public BaseUrlConfigurationElement ApiBaseUrl {
            get { return (BaseUrlConfigurationElement)base[_baseurl]; }
        }

        [ConfigurationProperty("apiPostResource", IsRequired = false)]
        public PostResourceConfigurationElement ApiPostResource {
            get { return (PostResourceConfigurationElement)base[_postresource]; }
        }

        [ConfigurationProperty("blogID", IsRequired = true)]
        public string BlogID {
            get { return (string)base[_blogid]; }
            set { base[_blogid] = value; }
        }

        private static ConfigurationPropertyCollection _collection;

        static MetaweblogChannelSection() {
            _httpbasicauth = new ConfigurationProperty(
                "httpBasicAuth",
                typeof(HttpBasicAuthConfigurationElement),
                null,
                ConfigurationPropertyOptions.IsRequired
                );
            _baseurl = new ConfigurationProperty(
                "apiBaseUrl",
                typeof(BaseUrlConfigurationElement),
                null,
                ConfigurationPropertyOptions.IsRequired
                );
            _postresource = new ConfigurationProperty(
                "apiPostResource",
                typeof(PostResourceConfigurationElement),
                null
                );
            _blogid = new ConfigurationProperty("blogID", typeof(string));

            _collection = new ConfigurationPropertyCollection {
                _httpbasicauth, _baseurl, _postresource, _blogid
            };
        }


        protected override ConfigurationPropertyCollection Properties {
            get {
                return _collection;
            }
        }


    }
}
